﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraCharts;
using DevExpress.XtraPivotGrid;
using DevExpress.XtraGrid;

namespace efuture.vdrp
{
    public partial class frmReportChart : DevExpress.XtraEditors.XtraForm
    {
        public PivotGridControl dsPGC;

        public frmReportChart()
        {
            InitializeComponent();
        }

        private void frmReportChart_Load(object sender, EventArgs e)
        {
            this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
            this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;

            chartControl1.Series.Clear();

            comboChartType.Properties.Items.AddRange(new ViewType[] {
                ViewType.Bar, ViewType.StackedBar, ViewType.FullStackedBar,
                ViewType.Point, ViewType.Line, ViewType.StepLine, ViewType.Spline, 
                ViewType.Area, ViewType.SplineArea, ViewType.StackedArea, ViewType.StackedSplineArea,
                ViewType.FullStackedArea, ViewType.FullStackedSplineArea
            });
        }

        private void frmReportChart_Shown(object sender, EventArgs e)
        {
            if (dsPGC != null)
            {
                this.chartControl1.DataSource = dsPGC;
            }
        }

        private void comboChartType_SelectedIndexChanged(object sender, EventArgs e)
        {
            chartControl1.SeriesTemplate.ChangeView((ViewType)comboChartType.SelectedItem);
        }

        private void checkShowPointLabels_CheckedChanged(object sender, EventArgs e)
        {
            chartControl1.SeriesTemplate.Label.Visible = checkShowPointLabels.Checked;
        }
    }
}